package team.jaman.autosell.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;

import team.jaman.autosell.dao.OrderdetailMapper;
import team.jaman.autosell.entity.Orderdetail;
import team.jaman.autosell.service.OrderdetailService;
import team.jaman.autosell.tools.PageData;
/**
 * 订单详情业务层实现类
 * @author Administrator
 *
 */
@Service
public class OrderdetailServiceImpl implements OrderdetailService {
	
	@Autowired
	private OrderdetailMapper orderdetailMapper;

	@Override
	public PageData<Orderdetail> selectOrderdetailByOrderId(int page, int limit, String orderId) {
		// pageHelper分页插件
		Page<Orderdetail> startPage = PageHelper.startPage(page, limit);
		// 订单详情数据
		List<Orderdetail> data = orderdetailMapper.selectOrderdetailByOrderId(orderId);
		// 总记录数
		long total = startPage.getTotal();
		PageData<Orderdetail> pageData = new PageData<>(data, (int) total, limit, page);
		pageData.setCode(0);
		pageData.setMsg("");
		return pageData;
	}

	

}
